package com.mike.uaa.server;

import com.google.common.collect.Lists;
import com.mike.uaa.server.authentication.converter.DelegatingAuthenticationConverter;
import com.mike.uaa.server.authentication.converter.UsernameCodeAuthenticationConverter;
import com.mike.uaa.server.authentication.converter.UsernamePasswordAuthenticationConverter;
import com.mike.uaa.server.authentication.converter.WeChatAuthenticationConverter;
import com.mike.uaa.server.authentication.provider.WeChatAuthenticationProvider;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import java.util.List;

/**
 * @author z zhang
 */
@SpringBootApplication
public class UAAApplication {

    public static void main(String[] args) {
        SpringApplication.run(UAAApplication.class, args);
    }



    @Bean
    public DelegatingAuthenticationConverter delegatingAuthenticationConverter() {
        return new DelegatingAuthenticationConverter(
                Lists.newArrayList(
                        new UsernamePasswordAuthenticationConverter(),
                        new WeChatAuthenticationConverter(),
                        new UsernameCodeAuthenticationConverter()
                )
        );
    }
}
